﻿<UserControl x:Class="PurchaseSales.Manage.Views.UserControls.AddUser"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:inf="clr-namespace:PurchaseSales.Manage.Common.Validates">
    <StackPanel>
        <TextBlock Text="用户编号"/>
        <TextBox x:Name="Element_Number" Text="{Binding Entity.AgentId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBlock Text="姓名"/>
        <TextBox x:Name="Element_Name" Text="{Binding Entity.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBlock Text="密码"/>
        <TextBox Text="{Binding Entity.Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBlock Text="角色"/>
        <ComboBox ItemsSource="{Binding ViewModel.AuthRolesCollection}" 
                  SelectedValue="{Binding ViewModel.SelectedAuthRole, Mode=TwoWay, 
            UpdateSourceTrigger=PropertyChanged}" IsSynchronizedWithCurrentItem="True">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding RoleName}"/>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <inf:RequiredValidator Property="{Binding Text,ElementName=Element_Number}"
                                  TriggerElement="{Binding ElementName=Element_Number}"/>
        <inf:RequiredValidator Property="{Binding Text,ElementName=Element_Name}"
                                  TriggerElement="{Binding ElementName=Element_Name}"/>
    </StackPanel>
</UserControl>
